#ifndef xpack_net_udp
#define xpack_net_udp
#pragma push_macro("xuser")
#undef  xuser
#define xuser mixc::net_udp::inc
#include"define/base_type.hpp"
#include"macro/xhand_over.hpp"
#include"macro/xstruct.hpp"
#include"net/private/base_net.hpp"

#undef  xuser
#define xuser mixc::net_udp::origin::udp
#include"net/private/define.hpp"
#pragma pop_macro("xuser")

namespace mixc::net_udp::origin::udp{
    xstruct(
        xname(p2p_v4),
        xpubb(inc::base_net)
    )
        using inc::base_net::base_net;

        p2p_v4()            = default;
        p2p_v4(p2p_v4 &&)   = default;
        xhand_over_with_close();

        bstate_t open(reuse_address_t mode = reuse_address_t::system_default) const;

        bstate_t open_with_bind(ipv4 ip, u16 port, reuse_address_t mode = reuse_address_t::system_default) const;

        bstate_t bind(ipv4 ip, u16 port) const;

        uxx read(voidp buffer, uxx bytes, ip_port_pair_v4 * from = nullptr) const;

        uxx write(void const * buffer, uxx bytes, ip_port_pair_v4 const & to) const;
    $

    using inc::sock_type_t;
}

#endif

xexport_space(mixc::net_udp::origin)
